local yingzi = fk.CreateSkill {

  name = "joyex__yingzi",

  tags = { Skill.Compulsory, },

}



yingzi:addEffect(fk.DrawNCards, {
  name = "joyex__yingzi",
  anim_type = "drawcard",
  frequency = Skill.Compulsory,
  events = {fk.DrawNCards},
  can_trigger = function(self, event, target, player, data)
    return  target == player and player:hasSkill(yingzi.name)
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local n = 0
    if player:getHandcardNum() >= 2 then
      n = n + 1
    end
    if player.hp >= 2 then
      n = n + 1
    end
    if #player:getCardIds("e") >= 1 then
      n = n + 1
    end
    n = math.max(1,n)
    data.n = data.n + n
  end,
})

yingzi:addEffect("maxcards", {
  name = "#joy__yingzi_maxcards",
  fixed_func = function(self, player)
    if player:hasSkill(yingzi.name) then
      return player.maxHp
    end
  end,
  correct_func = function(self, player)
    if player:hasSkill(yingzi.name) then
      local n = 0
    if player:getHandcardNum() >= 2 then
      n = n + 1
    end
    if player.hp >= 2 then
      n = n + 1
    end
    if #player:getCardIds("e") >= 1 then
      n = n + 1
    end
    n = math.max(1,n)
    return n
    end
  end,
})

return yingzi